/*
    This is a set of libraries to assist in OpenGl and Other Applications
    Copyright (C) 2008  The Modular Engine Team

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MATH_H
#define MATH_H

// TODO: 
// Vector2d needs to have operators against floats/ints
// Vector3d needs that and Vector3d operators.
// Also dot and cross product.

namespace ModularEngine
{
	class Vector2d
	{
	public:
		float x, y;

		Vector2d()
		{
			x = 0;
			y = 0;
		}

		Vector2d( float X, float Y )
		{
			x = X;
			y = Y;
		}

		Vector2d operator + (Vector2d vVec)
		{
			return Vector2d( x+vVec.x, y+vVec.y );
		}

		Vector2d operator - (Vector2d vVec)
		{
			return Vector2d( x-vVec.x, y-vVec.y );
		}

		Vector2d operator * (Vector2d vVec )
		{
			return Vector2d( x*vVec.x, y*vVec.y );
		}

		Vector2d operator / (Vector2d vVec )
		{
			return Vector2d( x/vVec.x, y/vVec.y );
		}

		void operator = (Vector2d vVec)
		{
			x = vVec.x;
			y = vVec.y;
		}
	};

	class Vector3d
	{
	public:
		float x, y, z;

		Vector3d()
		{
			x = y = z = 0;
		}
		Vector3d( float X, float Y, float Z )
		{
			x = X;
			y = Y;
			z = Z;
		}

		Vector3d operator * (Vector3d vVec)
		{
			return Vector3d( vVec.x*x, vVec.y*y, vVec.z*z );
		}

		Vector3d operator * (float fMultiplier)
		{
			return Vector3d( x*fMultiplier, y*fMultiplier, z*fMultiplier );
		}

		Vector3d operator - (Vector3d vVec)
		{
			return Vector3d( x-vVec.x, y-vVec.y, z-vVec.z );
		}

		Vector3d operator - (float n)
		{
			return Vector3d( x-n, y-n, z-n );
		}

		Vector3d operator + (Vector3d vVec)
		{
			return Vector3d( x+vVec.x, y+vVec.y, z+vVec.z );
		}

		Vector3d operator + (float n)
		{
			return Vector3d( x+n, y+n, z+n );
		}

		Vector3d operator / (Vector3d vVec)
		{
			return Vector3d( x/vVec.x, y/vVec.y, z/vVec.z );
		}

		Vector3d operator / (float n)
		{
			return Vector3d( x/n, y/n, z/n );
		}

		void operator = (Vector2d vVec)
		{
			x = vVec.x;
			y = vVec.y;
			z = 0;
		}

		void operator = (Vector3d vVec )
		{
			x = vVec.x;
			y = vVec.y;
			z = vVec.z;
		}

		void operator += (Vector3d vVec)
		{
			
			x += vVec.x;
			y += vVec.y;
			z += vVec.z;
		}

		void operator -= (Vector3d vVec)
		{
			x -= vVec.x;
			y -= vVec.y;
			z -= vVec.z;
		}

		void operator *= (Vector3d vVec)
		{
			x *= vVec.x;
			y *= vVec.y;
			z *= vVec.z;
		}
		
		void operator /= (Vector3d vVec)
		{
			x /= vVec.x;
			y /= vVec.y;
			z /= vVec.z;
		}

	};
}

#endif
